package com.atguigu.gmall.feign.search;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.search.Goods;
import com.atguigu.gmall.search.vo.SearchParamVo;
import com.atguigu.gmall.search.vo.SearchResultVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author lfy
 * @Description
 * @create 2023-08-26 8:45
 */
@RequestMapping("/api/inner/search")
@FeignClient("service-search")
public interface SearchFeignClient {

    /**
     * 更新热度分
     * @param skuId  商品id
     * @param score  最新热度分
     * @return
     */
    @GetMapping("/incrhotscore/{skuId}/{score}")
    public Result incrHotScore(@PathVariable("skuId") Long skuId,
                               @PathVariable("score") Long score);

    /**
     * 检索
     * @param searchParam
     * @return
     */
    @PostMapping("/search")
    Result<SearchResultVo> search(@RequestBody SearchParamVo searchParam);

    /**
     * 保存 商品数据 到 ES
     * @param goods
     * @return
     */
    @PostMapping("/save")
    Result saveGoods(@RequestBody Goods goods);


    /**
     * 商品下架
     * @param skuId
     * @return
     */
    @DeleteMapping("/goods/{skuId}")
    Result delete(@PathVariable("skuId") Long skuId);
}
